<div class="container-fluid">
    <div class="block-header">
        <h2>设置 > 视频 & 音频设置</h2>
    </div>
    <!-- Vertical Layout -->
    <div class="row">
        <div class="col-lg-6 col-md-6">
            <div class="card">
                <div class="header">
                    <h2>视频 & 音频聊天设置</h2>
                </div>
                <div class="body">
                    <div class="alert alert-success email-settings-alert"></div>
                    <form class="email-settings" method="POST">
                        <label for="video_chat">视频聊天</label>
                        <div class="form-group">
                            <input type="radio" name="video_chat" id="video_chat-enabled" value="1" <?php echo ($wo['config']['video_chat'] == 1) ? 'checked': '';?>>
                            <label for="video_chat-enabled">启用</label>
                            <input type="radio" name="video_chat" id="video_chat-disabled" value="0" <?php echo ($wo['config']['video_chat'] == 0) ? 'checked': '';?>>
                            <label for="video_chat-disabled" class="m-l-20">禁用</label>
                        </div>
                        <label for="audio_chat">音频聊天</label>
                        <div class="form-group">
                            <input type="radio" name="audio_chat" id="audio_chat-enabled" value="1" <?php echo ($wo['config']['audio_chat'] == 1) ? 'checked': '';?>>
                            <label for="audio_chat-enabled">启用</label>
                            <input type="radio" name="audio_chat" id="audio_chat-disabled" value="0" <?php echo ($wo['config']['audio_chat'] == 0) ? 'checked': '';?>>
                            <label for="audio_chat-disabled" class="m-l-20">禁用</label>
                        </div>
                        <div>
                        	要开始使用此功能，您需要在Twilio中创建一个帐户并购买“Programmable Video”产品。
                        </div>
                        <br><br>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input type="text" id="video_accountSid" name="video_accountSid" class="form-control" value="<?php echo $wo['config']['video_accountSid'];?>">
                                <label class="form-label">Live accountSid</label>
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input type="text" id="video_apiKeySid" name="video_apiKeySid" class="form-control" value="<?php echo $wo['config']['video_apiKeySid'];?>">
                                <label class="form-label">apiKeySid</label>
                            </div>
                        </div>
                        <div class="form-group form-float">
                            <div class="form-line">
                                <input type="password" id="video_apiKeySecret" name="video_apiKeySecret" class="form-control" value="<?php echo $wo['config']['video_apiKeySecret'];?>">
                                <label class="form-label">apiKeySecret</label>
                            </div>
                        </div>
                        <input type="hidden" name="hash_id" value="<?php echo Wo_CreateSession();?>">
                        <button type="submit" class="btn btn-primary m-t-15 waves-effect">保存</button>
                    </form>
                </div>
            </div>
        </div>
        <div class="clearfix"></div>
    </div>
    <!-- #END# Vertical Layout -->
<script>

$(function() {
    var form_email_settings = $('form.email-settings');
    form_email_settings.ajaxForm({
        url: Wo_Ajax_Requests_File() + '?f=admin_setting&s=update_general_setting',
        beforeSend: function() {
            form_email_settings.find('button').text('请稍后..');
        },
        success: function(data) {
            if (data.status == 200) {
                form_email_settings.find('button').text('保存');
                $("html, body").animate({ scrollTop: 0 }, "slow");
                $('.email-settings-alert').html('<i class="fa fa-check"></i> 设置更新成功');
                setTimeout(function () {
                    $('.email-settings-alert').empty();
                }, 2000);
            }
        }
    });
});
</script>